-- The following handlers ( @, ?, !, activate, deactivate, store, restore, initTracking, exitTracking, writeData, writeTextFile, stringEntry ) are copyright ⌐ 1990-94 by W.D.Patrick and Cornell University and are used herein with permission.
--ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
--ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
on @ spriteNum --ò provides the sprite location and center (USE CENTER WHEN locH&V ARE RETURNED AS NONSENSE VALUES.)
put "Sprite locH & locV: (" & the locH of sprite spriteNum& "," & the locV of sprite spriteNum & "). Sprite center: (" &(the right of sprite spriteNum-the left of sprite spriteNum)/2+the left of sprite spriteNum & "," & (the bottom of sprite spriteNum-the top of sprite spriteNum)/2+the top of sprite spriteNum &")"
end
on ? spriteNum --ò automates "activate" script writing. Place desired cast on stage in correct position
set theCast2=the castNum of sprite spriteNum
set theCast=string (numToChar(65+(theCast/64))) & ((theCast mod 64/8)+1) & (theCast mod 64 mod 8)
if the name of cast (theCast2)<>"0" then set theCast2=quote & the name of cast (theCast2) & quote
set putLine="Sprite: " & spriteNum & " Cast: " & theCast2 & " Type: " & the type of sprite spriteNum & " Ink: " & the ink of sprite spriteNum
set putLine=putLine& " LocH,LocV: (" & the locH of sprite spriteNum & "," & the locV of sprite spriteNum & ")"
set putLine=putLine& " Corners: (" & the left of sprite spriteNum & "," & the top of sprite spriteNum & "),(" & the right of sprite spriteNum & "," & the bottom of sprite spriteNum & ")"
set putLine=putLine& " Stretch: " & the stretch of sprite spriteNum & " Cursor: " & the cursor of sprite spriteNum
set putLine=putLine& return & return & "To activate [ spriteNum ] , copy this into your script: "
set putLine2="activate [ spriteNum ] ," & theCast2 & "," & the type of sprite spriteNum & "," & the ink of sprite spriteNum & ","
if the stretch of sprite spriteNum=0 then set putLine2=putLine2& the locH of sprite spriteNum & "," & the locV of sprite spriteNum & "," & quote & quote & "," & quote & quote & "," & quote
else set putLine2=putLine2& the left of sprite spriteNum & "," & the top of sprite spriteNum & "," & quote &"stretch to:" "e& "," & the right of sprite spriteNum & "," & the bottom of sprite spriteNum & return
put putLine&putLine2
end
on ! spriteNum --ò provides the cursor location. With the message window open and selected, place the cursor HotSpot over desired pixel. Type ! and return
if value(spriteNum)>0 then put "Cursor location, relative to the top left corner of sprite "&spriteNum&": (" & the mouseH-the left of sprite spriteNum & "," & the mouseV-the top of sprite spriteNum & ")."
else put "Cursor location: (" & the mouseH & "," & the mouseV & ")."
end
--ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
--ò Activate / deactivate sprites ù Create puppetSprites with given dimensions/positions or return sprite control to the score
--ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
on activate spriteNum,targetCast,targetType,targetInk,targetH,targetV,stretchBool,targetH2,targetV2
puppetsprite spriteNum, true
set the type of sprite spriteNum=targetType
set the castNum of sprite spriteNum=the number of cast targetCast
set the ink of sprite spriteNum=targetink
set the foreColor of sprite spriteNum=255
set the backColor of sprite spriteNum=0
set the locH of sprite spriteNum=targetH
set the locV of sprite spriteNum=targetV
set the stretch of sprite spriteNum=(stretchBool<>"") --ò stretch=true if stretchBool is NOT empty
if stretchBool<>"" and targetH2<>"" then spritebox spriteNum,targetH,targetV,targetH2,targetV2
set the immediate of sprite spriteNum=true
end
--ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
on deactivate spriteList
repeat with x=1 to the number of items in spriteList
set spriteNum=value ( item 1 of spriteList )
set the type of sprite spriteNum=0
puppetSprite spriteNum, false
end repeat
end
--ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
--ò Store / restore sprites ù Create puppetSprites with given dimensions/positions or return sprite control to the score